home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / PASCAL / BIGLDSW.ZIP / TUTOR2.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-07-28  |  1.4 KB  |  53 lines

  1. {
  2.   TUTOR2.PAS
  3.  
  4.   This file shows, how to handle to simultanously opened files.
  5.  
  6. }
  7.  
  8. uses crt, _BigLoad;
  9.  
  10. const
  11.   Stream1 : byte = 1;
  12.   Stream2 : byte = 2;
  13.  
  14. var
  15.   HelpByte : Byte;
  16.   Counter  : Byte;
  17.  
  18. begin
  19.   ClrScr;
  20.  
  21.   { open the BigFile "TESTBIG" and handle the index from disk. You may also
  22.     try to hanlde the index from memory with IndexFromMemory }
  23.   BigFileInit( 'TESTBIG', IndexFromDisk );
  24.  
  25.   { open a file for reading from the BigFile by the stream Stream1 and
  26.     reset it. The second parameter of BigReset has NO effect on any
  27.     procedures or functions of BigLoad. It exists just to make it easier
  28.     to convert your routines to BigFile-compatible ones. }
  29.   BigAssign( Stream1, 'TESTFILE.TXT' );
  30.   BigReset( Stream1, 1 );
  31.  
  32.   { open a second file to read from BigFile by the stream Stream2 }
  33.   BigAssign( Stream2, 'HOMEPAGE.TXT' );
  34.   BigReset( Stream2, 1 );
  35.  
  36.   { read the first 100 charakters byte after byte of each file from BigFile
  37.     and display them on the screen }
  38.   for Counter := 1 to 100 do
  39.     begin
  40.       { read from Stream1 }
  41.       BigReadB( Stream1, HelpByte ); Write( Chr( HelpByte ) );
  42.       { now read from Stream2 }
  43.       BigReadB( Stream2, HelpByte ); Write( Chr( HelpByte ) );
  44.     end;
  45.  
  46.   { close streams Stream1 and Stream2 of the BigFile }
  47.   BigClose( Stream1 );
  48.   BigClose( Stream2 );
  49.  
  50.   { close reading from the BigFile }
  51.   BigFileClose;
  52. end.
  53.